import request from '@/utils/request'

/**
 * 根据parentId查询商品分类
 */
export async function listCategoriesByParentId(parentId) {
  let url = '/service-goods/category/listCategoriesByParentId?parentId='
  if (parentId) {
    url += parentId
  }
  return await request.loadData(url)
}

/**
 * 根据商品标识查询商品分类的完整名称
 */
export async function getCategoryFullName(categoryId) {
  return await request.loadData('/service-goods/category/fullname/' + categoryId)
}

/**
 * 保存商品分类树节点
 */
export function saveCategoryTreeNode(data) {
  return request({
    url: '/service-goods/category/save',
    method: 'post',
    data
  })
}
